import {req_delete, req_get, req_post, req_put} from "@/request/cssdrequest";
import {R} from "@/type/dto/R";
import {ScheduleTypeVO} from "@/type/vo/ScheduleTypeVO";
import {ScheduleShiftVO} from "@/type/vo/ScheduleShiftVO";
import {RP} from "@/type/dto/RP";
import {UserSchedulesInfoVO} from "@/type/vo/UserSchedulesInfoVO";
import {ScheduleUserDto} from "@/type/dto/ScheduleUserDto";

export async function api_listScheduleUser(startDate: string, endDate: string, officeCode: string, page:number, limit:number) {
    const data = await req_get('/schedule/user', {
        startDate,
        endDate,
        officeCode,
        page,
        limit
    });
    //转成我要的json
    console.log('data:', data);
    return JSON.parse(data) as R<RP<UserSchedulesInfoVO>>;
}


export async function api_addScheduleUser(scheduleUser:ScheduleUserDto) {
    const data = await req_post('/schedule/user', scheduleUser);
    //转成我要的json
    console.log('data:', data);
    return JSON.parse(data) as R<object>;
}

export async function api_editScheduleUser(scheduleUser:ScheduleUserDto) {
    const data = await req_put('/schedule/user', scheduleUser);
    //转成我要的json
    console.log('data:', data);
    return JSON.parse(data) as R<object>;
}
